//
//  DYZixunInputViewController.swift
//  SheYangBigData
//
//  Created by 宋海胜 on 2021/1/6.
//  Copyright © 2021 叁拾叁. All rights reserved.
//

import UIKit

class DYZixunInputViewController: SYBaseViewController {

    var shuruView: DYZixunInputView!
    var zixunModel: DYZixunModel!
    
    init(model: DYZixunModel) {
        super.init(nibName: nil, bundle: nil)
        
        self.zixunModel = model
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
        super.viewDidLoad()

        self.title = "我要咨询"
        creatInputView()
    }
    
    func creatInputView() {
        shuruView = DYZixunInputView()
        shuruView.configure(self.zixunModel)
        shuruView.currentVC = self
        shuruView.clickedClosure = {[weak self] _ in
            if let `self` = self {
                self.addData()
            }
        }
        self.view.addSubview(shuruView)
        shuruView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(NAV_HEIGHT)
            make.left.right.bottom.equalToSuperview()
        }
    }
    
    func addData() {
        requestVM.baseRequest(disposeBag: dispose, type: .dy_jingquZixunAdd(dic: ["type":self.zixunModel.id ?? "", "typeId": self.zixunModel.id ?? "", "issue": self.shuruView.textView.text ?? ""]), modelClass: SGBaseModel<DYDanLanModel>.self) {[weak self] (res) in
            if let `self` = self {
                
            }
            
        } Error: {
            
        }
    }
    
}
